#include<stdio.h>
#include<stdlib.h>

int main()
{
    int *a = 0;
    int n;
    scanf("%d", &n);
    a = (int*)malloc(n*sizeof(int));
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
    }
    int max = a[0];
    for (int j = 1; j< n; j++)
    {
        if (a[j] > max)
        {
            max = a[j];
        }
    }
    int k;
    for (k = 0; k < n; k++)
    {
        if (a[k] == max)
        {
            break;
        }
    }
    printf("%d %d", max, k);
    free(a);

    return 0;
}